/*
 * Copyright (c) 2018, apexes.net. All rights reserved.
 *
 *         http://www.apexes.net
 *
 */
package net.apexes.codegen.core;

import com.querydsl.codegen.EntityType;
import com.querydsl.codegen.utils.model.ClassType;
import com.querydsl.codegen.utils.model.Type;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * @author <a href="mailto:hedyn@foxmail.com">HeDYn</a>
 *
 */
public class EntityModel extends EntityType {
    
    private List<Type> interfaces = new ArrayList<>();
    private SuperType supertype;

    public EntityModel(Type type) {
        super(type);
    }

    public EntityModel(Type type, SuperType supertype) {
        this(type);
        this.supertype = supertype;
    }
    
    public void addInterface(Class<?> iface) {
        interfaces.add(new ClassType(iface));
    }

    public void addInterface(Type iface) {
        interfaces.add(iface);
    }
    
    public List<Type> getInterfaces() {
        return interfaces;
    }
    
    @Override
    public SuperType getSuperType() {
        return supertype;
    }
    
    public void setSupertype(SuperType supertype) {
        this.supertype = supertype;
        super.addSupertype(supertype);
    }
}
